/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dsmsforkjoin;

import java.util.ArrayList;
import tuplegenerator.Tuple;

/**
 *
 *
 */
public class ForkListSimpleQueue<T extends Tuple> implements ForkList<IForkQueue<T>, T> {
    
    private ArrayList<IForkQueue<T>> heaps = null;
    
    public ForkListSimpleQueue(int n) {
        heaps = new ArrayList<IForkQueue<T>>();
        for (int i=0; i<n; i++) {
        	IForkQueue<T> ifq = new ListQueue<T>();
            heaps.add(ifq);
        }
    }
    
    @Override
    public IForkQueue<T> getQueue(int index) {
        return heaps.get(index);
    }
    
    public void addTuple(int index, T tuple, double priority) {
        heaps.get(index).addItem(tuple);
    }

    @Override
    public void addTuple(int index, T tuple) {
        heaps.get(index).addItem(tuple);
    }

    @Override
    public int listCount() {
        return this.heaps.size();
    }
    
}
